import Vue from 'vue'
import Vuex from 'vuex'
import createLogger from 'vuex/dist/logger'

const debug = process.env.NODE_ENV !== 'production'

import mes from './mes'
import maintenance from './maintenance/index'
import * as getters from './getters'
import mutations from './mutations'
import * as actions from './actions'
import state from './state'

Vue.use(Vuex)

/*
 * If not building with SSR mode, you can
 * directly export the Store instantiation
 */
export default function (/* { ssrContext } */) {
  const Store = new Vuex.Store({
    modules: {
      mes,
      maintenance
    },
    getters,
    mutations,
    actions,
    state,

    // enable strict mode (adds overhead!)
    // for dev mode only
    plugins: debug ? [createLogger()] : []
  })

  return Store
}
